package 文件内容操作;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:try with resource 会自动关闭try()里的文件:try结束后会自动调用close
 * User: lenovo
 * Date: 2022-10-16
 * Time: 21:26
 */
public class demo8 {
        public static void main(String[] args) throws IOException {
            try( OutputStream outputStream = new FileOutputStream("./bbb.txt");/*这里相当于打开了文件 会将文件里原有的内容删除*/){
                 outputStream.write(97);
                 outputStream.write(98);
                 outputStream.write(99);
                 byte[] b = {100,101,102};//数组
                 outputStream.write(b);//参数为数组

            }


        }
}
